Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updates semantic version on docs #500

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Joshua-Briggs
Copy link
Member

@Joshua-Briggs Joshua-Briggs commented Jan 6, 2025

User description

notes:
01 - when loading a doc im creating a new instance of rl instead of using the same rl, you might want to check this to make sure its correct. 05 - cannot get the LLM to run with the semantic router 07 - compatibility issues with the encoder, also think the dependency semantic_router[vision] needs updating


PR Type

Enhancement, Documentation


Description

  • Updated dependencies to use semantic-router==0.1.0.dev3 across multiple notebooks.

  • Replaced RouteLayer with SemanticRouter for improved functionality.

  • Enhanced logging and warnings for better debugging and user feedback.

  • Adjusted execution counts and outputs in Jupyter notebooks for consistency.


Changes walkthrough 📝

Relevant files
Enhancement
02-dynamic-routes.ipynb
Refactored dynamic routes notebook with updated dependencies

docs/02-dynamic-routes.ipynb

  • Updated semantic-router version to 0.1.0.dev3.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted execution counts and outputs for consistency.
  • Enhanced logging with warnings and HTTP request details.
  • +116/-75
    03-basic-langchain-agent.ipynb
    Updated basic LangChain agent notebook dependencies and imports

    docs/03-basic-langchain-agent.ipynb

  • Updated semantic-router version to 0.1.0.dev3.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted execution counts and outputs for consistency.
  • Updated LangChain imports to use langchain_openai.
  • +153/-71
    08-async-dynamic-routes.ipynb
    Refactored async dynamic routes notebook with updated dependencies

    docs/08-async-dynamic-routes.ipynb

  • Updated semantic-router version to 0.1.0.dev3.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted execution counts and outputs for consistency.
  • Enhanced logging with warnings and HTTP request details.
  • +125/-59
    01-save-load-from-file.ipynb
    Refactored save/load notebook with updated dependencies   

    docs/01-save-load-from-file.ipynb

  • Updated semantic-router version to 0.1.0.dev3.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted execution counts and outputs for consistency.
  • Enhanced logging and added metadata to routes.
  • +68/-32 
    06-threshold-optimization.ipynb
    Updated threshold optimization notebook with improved accuracy

    docs/06-threshold-optimization.ipynb

  • Updated semantic-router version to 0.1.0.dev3.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted execution counts and outputs for consistency.
  • Improved threshold optimization accuracy and logging.
  • +47/-29 
    09-route-filter.ipynb
    Refactored route filter notebook with updated dependencies

    docs/09-route-filter.ipynb

  • Updated semantic-router version to 0.1.0.dev3.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted execution counts and outputs for consistency.
  • Enhanced logging with warnings and HTTP request details.
  • +33/-28 

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    notes:
    01 - when loading a doc im creating a new instance of rl instead of using the same rl, you might want to check this to make sure its correct.
    05 - cannot get the LLM to run with the semantic router
    07 - compatibility issues with the encoder, also think the dependency semantic_router[vision] needs updating
    Copy link

    github-actions bot commented Jan 6, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Deprecation Warning

    The code introduces a DeprecationWarning related to the use of datetime.datetime.utcnow(). This method is deprecated and scheduled for removal in a future version. It is recommended to use timezone-aware objects like datetime.datetime.now(datetime.UTC) instead.

    "C:\\Users\\Joshu\\AppData\\Local\\Temp\\ipykernel_13320\\3683005204.py:28: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).\n",
    "  now_utc = datetime.utcnow().replace(tzinfo=ZoneInfo(\"UTC\"))\n"
    
    Performance Degradation

    The updated code shows a significant decrease in performance for generating embeddings and training speeds compared to the previous implementation. This should be reviewed to ensure it does not negatively impact the overall system performance.

    "Generating embeddings: 100%|██████████| 1/1 [00:00<00:00,  6.28it/s]\n",
    "Training: 100%|██████████| 500/500 [00:03<00:00, 147.86it/s, acc=0.91]\n"
    
    Logging and Configuration Issues

    The code introduces warnings related to missing index configurations and local index writing. These warnings should be addressed to ensure proper logging and configuration management.

    "2025-01-06 12:04:38 - semantic_router.utils.logger - WARNING - base.py:356 - _get_index() - No index provided. Using default LocalIndex.\n",
    "2025-01-06 12:04:38 - semantic_router.utils.logger - WARNING - local.py:148 - _write_config() - No config is written for LocalIndex.\n"
    

    Copy link

    github-actions bot commented Jan 6, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Resolve the DeprecationWarning for datetime.datetime.utcnow() by using timezone-aware objects

    Address the DeprecationWarning for datetime.datetime.utcnow() by switching to
    timezone-aware objects to ensure future compatibility and avoid unexpected behavior.

    docs/02-dynamic-routes.ipynb [1034-1035]

    -"now_utc = datetime.utcnow().replace(tzinfo=ZoneInfo(\"UTC\"))"
    +"now_utc = datetime.now(datetime.UTC).replace(tzinfo=ZoneInfo(\"UTC\"))"
    Suggestion importance[1-10]: 9

    Why: The suggestion effectively addresses a DeprecationWarning by switching to timezone-aware objects, ensuring future compatibility and avoiding potential runtime issues. This is a significant improvement to the code's robustness.

    9
    Security
    Ensure sensitive data in HTTP request logs is redacted to maintain security and privacy

    Review the handling of HTTP requests logged by httpx to ensure sensitive data is not
    inadvertently exposed in logs, especially in production environments.

    docs/03-basic-langchain-agent.ipynb [210]

    -"2025-01-06 12:13:03 - httpx - INFO - _client.py:1025 - _send_single_request() - HTTP Request: POST https://api.openai.com/v1/embeddings \"HTTP/1.1 200 OK\"\n",
    +"2025-01-06 12:13:03 - httpx - INFO - _client.py:1025 - _send_single_request() - HTTP Request: POST https://api.openai.com/v1/embeddings \"HTTP/1.1 200 OK\" (redacted sensitive data)\n",
    Suggestion importance[1-10]: 9

    Why: Redacting sensitive data in HTTP request logs is a critical security measure, especially in production environments. The suggestion is highly relevant and improves the security of the application.

    9
    General
    Address the missing IProgress warning by ensuring required dependencies are installed

    Handle the warning about missing IProgress by ensuring the required jupyter and
    ipywidgets dependencies are installed to avoid user confusion or degraded
    functionality.

    docs/01-save-load-from-file.ipynb [82]

    -"c:\\Users\\Joshu\\OneDrive\\Documents\\Aurelio\\agents-course\\07-pratical-ai\\.venv\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n"
    +"!pip install -qU jupyter ipywidgets"
    Suggestion importance[1-10]: 8

    Why: The suggestion effectively addresses a warning about missing IProgress by ensuring the installation of required dependencies (jupyter and ipywidgets). This improves user experience and avoids potential confusion or degraded functionality.

    8
    Verify compatibility and stability of the updated dependency version to prevent potential runtime conflicts

    Ensure that the new dependency version semantic-router==0.1.0.dev3 is stable and
    compatible with the other dependencies, especially langchain==0.0.352 and
    openai>=1.6.1, to avoid runtime issues.

    docs/03-basic-langchain-agent.ipynb [55]

    -"    \"semantic-router==0.1.0.dev3\" \\\n",
    +"    \"semantic-router==0.1.0\" \\\n",
    Suggestion importance[1-10]: 7

    Why: The suggestion to ensure compatibility of the new dependency version is valid and important to prevent runtime issues. However, the improved code changes the version to a stable release without verifying if this is the intended version, which could lead to unintended consequences.

    7
    Verify the new auto_sync="local" parameter to ensure it functions as intended without conflicts

    Validate the new auto_sync="local" parameter in SemanticRouter initialization to
    ensure it does not introduce unexpected behavior or conflicts with other
    configurations.

    docs/01-save-load-from-file.ipynb [155]

    -"rl = SemanticRouter(encoder=encoder, routes=routes, auto_sync=\"local\")"
    +"rl = SemanticRouter(encoder=encoder, routes=routes, auto_sync=\"local\")  # Ensure 'local' sync works as expected"
    Suggestion importance[1-10]: 6

    Why: While the suggestion to validate the auto_sync="local" parameter is reasonable, it is not actionable as it only asks for verification. The improved_code adds a comment but does not provide any functional enhancement or validation mechanism.

    6
    Validate the correctness of updated route configurations and metadata to prevent runtime issues

    Confirm that the updated route configurations and their metadata are correctly
    loaded and processed to avoid potential runtime errors or incorrect behavior.

    docs/01-save-load-from-file.ipynb [362]

    -"rl.routes=[Route(name='politics', utterances=[\"isn't politics the best thing ever\", \"why don't you tell me about your political opinions\", \"don't you just love the presidentdon't you just hate the president\", \"they're going to destroy this country!\", 'they will save the country!'], description=None, function_schemas=None, llm=None, score_threshold=0.3, metadata={}), Route(name='chitchat', utterances=[\"how's the weather today?\", 'how are things going?', 'lovely weather today', 'the weather is horrendous', \"let's go to the chippy\"], description=None, function_schemas=None, llm=None, score_threshold=0.3, metadata={})]"
    +"rl.routes=[Route(name='politics', utterances=[...], metadata={}), Route(name='chitchat', utterances=[...], metadata={})]  # Ensure routes are correctly processed"
    Suggestion importance[1-10]: 6

    Why: The suggestion highlights the importance of ensuring the correctness of updated route configurations and metadata. However, it is not actionable as it only asks for confirmation and adds a comment without implementing any validation or checks.

    6
    Verify the accuracy and consistency of updated outputs to avoid logical discrepancies in responses

    Validate the correctness of the updated outputs and execution results to ensure they
    align with the intended functionality and do not introduce logical errors.

    docs/03-basic-langchain-agent.ipynb [763]

    -" 'output': \"I don't do training sessions myself, but I can certainly guide you through workouts and provide advice. As for the cost, well, let's just say it's worth every penny!\"}"
    +" 'output': \"I don't do training sessions myself, but I can certainly guide you through workouts and provide advice. For training sessions, please refer to BigAI PT for accurate details.\"}"
    Suggestion importance[1-10]: 6

    Why: The suggestion to validate the correctness of updated outputs is reasonable and ensures logical consistency. However, the improved code introduces a change that may not align with the original intent, reducing its impact slightly.

    6

    Copy link

    codecov bot commented Jan 6, 2025

    Codecov Report

    All modified and coverable lines are covered by tests ✅

    Project coverage is 74.82%. Comparing base (9915053) to head (6b38f12).
    Report is 1 commits behind head on main.

    Additional details and impacted files
    @@            Coverage Diff             @@
    ##             main     #500      +/-   ##
    ==========================================
    - Coverage   74.84%   74.82%   -0.03%     
    ==========================================
      Files          43       43              
      Lines        3753     3753              
    ==========================================
    - Hits         2809     2808       -1     
    - Misses        944      945       +1     

    ☔ View full report in Codecov by Sentry.
    📢 Have feedback on the report? Share it here.

    @Joshua-Briggs Joshua-Briggs linked an issue Jan 7, 2025 that may be closed by this pull request
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Update all Jupyter notebooks for v0.1.0
    1 participant